Corrected TLS usage of IO::Socket::SSL #22
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
IO::Socket::SSL requires CA bundle location to be defined
Still using this script in 2020! 👍
NOTE: I'm not an expert just needed this to work and found a way!
Tested with Gmail TLS on port 587
[13:29 srvXXXXX ~]# /usr/bin/sendemail -t [email protected] -f [email protected] -u TESTSUBJECT -m TESTMESSAGE -s smtp.gmail.com:587 -xu [email protected] -xp password -v -v -o tls=yes
Aug 02 13:29:54 srvXXXXX sendemail[13611]: DEBUG => Connecting to smtp.gmail.com:587
Aug 02 13:29:55 srvXXXXX sendemail[13611]: DEBUG => My IP address is: 192.168.X.XX
Aug 02 13:29:55 srvXXXXX sendemail[13611]: DEBUG => evalSMTPresponse() - Found SMTP success code: 220
Aug 02 13:29:55 srvXXXXX sendemail[13611]: SUCCESS => Received: 220 smtp.gmail.com ESMTP n11sm12221358wmi.15 - gsmtp
Aug 02 13:29:55 srvXXXXX sendemail[13611]: INFO => Sending: EHLO srvXXXXX
Aug 02 13:29:55 srvXXXXX sendemail[13611]: DEBUG => evalSMTPresponse() - Found SMTP success code: 250
Aug 02 13:29:55 srvXXXXX sendemail[13611]: SUCCESS => Received: 250-smtp.gmail.com at your service, [85.244.XX.XX], 250-SIZE 35882577, 250-8BITMIME, 250-STARTTLS, 250-ENHANCEDSTATUSCODES, 250-PIPELINING, 250-CHUNKING, 250 SMTPUTF8
Aug 02 13:29:55 srvXXXXX sendemail[13611]: DEBUG => The remote SMTP server supports TLS :)
Aug 02 13:29:55 srvXXXXX sendemail[13611]: DEBUG => Starting TLS
Aug 02 13:29:55 srvXXXXX sendemail[13611]: INFO => Sending: STARTTLS
Aug 02 13:29:55 srvXXXXX sendemail[13611]: DEBUG => evalSMTPresponse() - Found SMTP success code: 220
Aug 02 13:29:55 srvXXXXX sendemail[13611]: SUCCESS => Received: 220 2.0.0 Ready to start TLS
Using the default of SSL_verify_mode of SSL_VERIFY_NONE for client
is deprecated! Please set SSL_verify_mode to SSL_VERIFY_PEER
possibly with SSL_ca_file|SSL_ca_path for verification.
If you really don't want to verify the certificate and keep the
connection open to Man-In-The-Middle attacks please set
SSL_verify_mode explicitly to SSL_VERIFY_NONE in your application.
at /usr/bin/sendemail line 1908.
Aug 02 13:29:55 srvXXXXX sendemail[13611]: DEBUG => TLS session initialized :)
Aug 02 13:29:55 srvXXXXX sendemail[13611]: INFO => Sending: EHLO srvXXXXX
Aug 02 13:29:55 srvXXXXX sendemail[13611]: DEBUG => evalSMTPresponse() - Found SMTP success code: 250
Aug 02 13:29:55 srvXXXXX sendemail[13611]: SUCCESS => Received: 250-smtp.gmail.com at your service, [85.244.XX.XX], 250-SIZE 35882577, 250-8BITMIME, 250-AUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN OAUTHBEARER XOAUTH, 250-ENHANCEDSTATUSCODES, 250-PIPELINING, 250-CHUNKING, 250 SMTPUTF8
Aug 02 13:29:55 srvXXXXX sendemail[13611]: DEBUG => SMTP-AUTH: Using LOGIN authentication method
Aug 02 13:29:55 srvXXXXX sendemail[13611]: INFO => Sending: AUTH LOGIN
Aug 02 13:29:55 srvXXXXX sendemail[13611]: DEBUG => evalSMTPresponse() - Found SMTP success code: 334
Aug 02 13:29:55 srvXXXXX sendemail[13611]: SUCCESS => Received: 334 VXNlcm5hbWU6
Aug 02 13:29:55 srvXXXXX sendemail[13611]: INFO => Sending: cmVkb3drQGdtYWlsLmNvbQ==
Aug 02 13:29:55 srvXXXXX sendemail[13611]: DEBUG => evalSMTPresponse() - Found SMTP success code: 334
Aug 02 13:29:55 srvXXXXX sendemail[13611]: SUCCESS => Received: 334 UGFzc3dvcmQ6
Aug 02 13:29:55 srvXXXXX sendemail[13611]: INFO => Sending: eWJweHh0cGN2cHBwYXdrbg==
Aug 02 13:29:55 srvXXXXX sendemail[13611]: DEBUG => evalSMTPresponse() - Found SMTP success code: 235
Aug 02 13:29:55 srvXXXXX sendemail[13611]: SUCCESS => Received: 235 2.7.0 Accepted
Aug 02 13:29:55 srvXXXXX sendemail[13611]: DEBUG => User authentication was successful (Method: LOGIN)
Aug 02 13:29:55 srvXXXXX sendemail[13611]: INFO => Sending: MAIL FROM:[email protected]
Aug 02 13:29:55 srvXXXXX sendemail[13611]: DEBUG => evalSMTPresponse() - Found SMTP success code: 250
Aug 02 13:29:55 srvXXXXX sendemail[13611]: SUCCESS => Received: 250 2.1.0 OK n11sm12221358wmi.15 - gsmtp
Aug 02 13:29:55 srvXXXXX sendemail[13611]: INFO => Sending: RCPT TO:[email protected]
Aug 02 13:29:55 srvXXXXX sendemail[13611]: DEBUG => evalSMTPresponse() - Found SMTP success code: 250
Aug 02 13:29:55 srvXXXXX sendemail[13611]: SUCCESS => Received: 250 2.1.5 OK n11sm12221358wmi.15 - gsmtp
Aug 02 13:29:55 srvXXXXX sendemail[13611]: INFO => Sending: DATA
Aug 02 13:29:55 srvXXXXX sendemail[13611]: DEBUG => evalSMTPresponse() - Found SMTP success code: 354
Aug 02 13:29:55 srvXXXXX sendemail[13611]: SUCCESS => Received: 354 Go ahead n11sm12221358wmi.15 - gsmtp
Aug 02 13:29:55 srvXXXXX sendemail[13611]: INFO => Sending message body
Aug 02 13:29:55 srvXXXXX sendemail[13611]: Setting content-type: text/plain
Aug 02 13:29:56 srvXXXXX sendemail[13611]: DEBUG => evalSMTPresponse() - Found SMTP success code: 250
Aug 02 13:29:56 srvXXXXX sendemail[13611]: SUCCESS => Received: 250 2.0.0 OK 1596371397 n11sm12221358wmi.15 - gsmtp
Aug 02 13:29:56 srvXXXXX sendemail[13611]: Email was sent successfully! From: [email protected] To: [email protected] Subject: [TESTSUBJECT] Server: [smtp.gmail.com:587]
[13:29 srvXXXXX ~]#